﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace SindSaude
{
    public partial class Fotos : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int idAlbum = 0;
            if (!IsPostBack)
            {
                if (Request.QueryString["a"].ToString() != "0")
                {
                    idAlbum = Convert.ToInt16(Request.QueryString["a"].ToString());
                    this.carregaGrid(idAlbum);
                    this.CarregaDataNome(idAlbum);
                }
            }
        }
        private void carregaGrid(int Album)
        {
            SindSaudeCamadas.Dados.Albuns albuns = new SindSaudeCamadas.Dados.Albuns();
            DataTable dt = new DataTable();
            dt = albuns.carregaFotos(Album);
            if (dt.Rows.Count >= 1)
            {
                AlbunsList.DataSource = dt;
                AlbunsList.DataBind();
                AlbunsList.RepeatDirection = RepeatDirection.Horizontal;
            }
        }
        private void CarregaDataNome(int idAlbum)
        {
            SindSaudeCamadas.Dados.Albuns albuns = new SindSaudeCamadas.Dados.Albuns();
            DataTable dt = new DataTable();
            dt = albuns.carregaAlbuns(idAlbum);
            if (dt.Rows.Count == 1)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lblnome.Text = Convert.ToString(dt.Rows[i]["strNome"]);
                    lblData.Text = Convert.ToString(dt.Rows[i]["strData"]);
                }
            }
        }
    }
}